package me.magicall.db.sql.expression;

import me.magicall.db.sql.Domain;

/**
 * 常量表达式
 * 
 * @author MaGiCalL
 */
public class ConstExpression extends Expression<Domain> {

	private Object constant;

	public ConstExpression() {
		super();
	}

	public ConstExpression(final Object constant) {
		super();
		this.constant = constant;
	}

	@Override
	public StringBuilder appendTo(final StringBuilder sb) {
		sb.append(" ");
		final Object c = getConstant();
		if (c instanceof String) {
			sb.append("'").append(constant).append("'");
		} else {
			sb.append(c);
		}
		return sb.append(" ");
	}

	public Object getConstant() {
		return constant;
	}

	public void setConstant(final Object constant) {
		this.constant = constant;
	}
}
